<?php

namespace App\Http\Controllers;

use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class GradeController extends Controller
{
    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Contracts\Support\Renderable|\Illuminate\Http\RedirectResponse
     */
    public function index()
    {
        /** @var User $user */
        $user = Auth::user();

        $userRank = User::query()->where('score', '>', $user->score)->count() + 1;

        return view('h5.grade', compact('user', 'userRank'));
    }
}
